home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
docs
/
mod2txt
/
chap16.txt
< prev
next >
Wrap
Text File
|
1987-03-25
|
4KB
|
124 lines
Chapter 16 - Complete example programs
The intent of this chapter is to give several example
programs that use nearly every capability of Modula-2 as
illustrations of large usable programs. The programs are
usable utilities, but primarily they are intended to
illustrate the method of building up a medium sized program
from the various constructs studied in the earlier chapters.
BAKLIST.MOD
This program generates a list of all files along with
their subdirectories. Some files are excluded from the list,
including all three files that comprise the DOS system and
the file generated here, FULLDISK.LST. This is an ASCII
file that can be edited with any text editor to eliminate
any files that you do not wish to back up. It should be
noted that the file, FULLDISK.LST, is created and filled in
the root directory of the default drive.
Select the desired subdirectory that you wish to back
up, and the files, subdirectories, and all of their
respective contents will be listed in FULLDISK.LST. The
resulting list is then used by BAKCOPY to actually copy the
files to a floppy disk.
BAKCOPY.MOD
This program uses FULLDISK.LST to actually copy the
files from the source disk to the target and requests a disk
change whenever the floppy disk fills up. It will not copy
a file larger than that which will fit on one disk, but will
give a message of which files are not copied.
BAKRSTR.MOD
This program will read the files from floppy back to
the fixed disk to restore it. It simply copies from
whatever directory they are in to the corresponding
directory on the fixed disk, creating the directory if
necessary.
DIRHELPS.DEF DIRHELPS.MOD
This global module contains several useful file
handling and directory manipulation procedures. It is
called by the above three example programs used for backup
and restore of a fixed disk. These routines are available
for your use also if you desire to use them for a file
manipulation program. Their main intent however is that
they be a guide for the student to observe methods used to
write library functions.
Page 99
Chapter 16 - Complete example programs
BITOPS.DEF BITOPS.MOD
This module has several generic bit operations such as
logical AND, OR, etc. and shift operations. These are
useful procedures that you can import and use in your
programs if you are doing bit manipulations.
REAL2MON.DEF REAL2MON.MOD
This module has a procedure to output REAL data to the
monitor in a neat, easy to read format. It is documented in
the header of the source files.
REAL2FIL.DEF REAL2FIL.MOD
This module has several procedures to output REAL and
other data type to a file using the FileSystem MODULE. The
various procedures are documented in their respective
headers.
Page 100